package com.hxd.otc.module.wallet.bean;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 作  者 :  卫广玉
 * 时  间 :  2018/6/19 10:20
 * 描  述 :  换币的交易详情
 */
public class CoinOneKeyRateVoBean implements Serializable {
    /**
     * isUse (integer, optional): 行情是否用，0.可用，1.不可用 ,
     * quotation (number, optional): 行情 ,
     * transactionPair (string, optional): 交易对
     */
    public String coinType;
    public List<WalletCoinRateData> exchangeRateVoList;
    public Map<String, Double> coinTypeMap;

    public Map<String, Double> getCoinTypeMap(List<WalletCoinRateData> dataList) {
        if (coinTypeMap == null) {
            coinTypeMap = new HashMap<>();
        } else {
            coinTypeMap.clear();
        }
        if (dataList == null) {
            return coinTypeMap;
        }
        for (WalletCoinRateData data : dataList) {
            coinTypeMap.put(data.coinType, data.amount);
        }
        return coinTypeMap;
    }

    public static class WalletCoinRateData {
        public int useStatus;//0：可用 1 不可用
        public double amount;//数量
        public String coinType;//币种 ,


        @Override
        public String toString() {
            return "WalletCoinRateData{" +
                    "useStatus=" + useStatus +
                    ", amount=" + amount +
                    ", coinType='" + coinType + '\'' +
                    '}';
        }
    }

    @Override
    public String toString() {
        return "WalletCoinRateVoBean{" +
                "coinType='" + coinType + '\'' +
                ", exchangeRateVoList=" + exchangeRateVoList +
                '}';
    }
}
